package com.bamboo.statistics.service;

import com.bamboo.commonutils.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author jack.wu
 * @version 1.0
 * @date 2020-07-23
 */
@Slf4j
@Component
public class StatisticsTask {

    @Resource
    private DailyService dailyService;

    @Scheduled(cron = "0 0 1 * * ? ")
    private void statisticsTask() {
        Date date = DateUtil.addDays(new Date(), -1);
        String day = DateUtil.formatDate(date);
        dailyService.getRegisterCount(day);
    }
}
